import { isEmptyArr } from '../index';

export function digitalFormat(dataSets) {
  const { dimensions, type, source } = dataSets;
  let result = [];
  const valueKey = type === 'STATIC' ? 'value' : dimensions?.yAxis;
  if (!isEmptyArr(source)) {
    const value = source[0][valueKey] ? source[0][valueKey] : 0;
    result = [Number(value)];
  }
  return {
    seriesData: result
  };
}
